home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
UUPC11QS.ARJ
/
LIB.H
< prev
next >
Wrap
C/C++ Source or Header
|
1991-11-17
|
13KB
|
297 lines
/*--------------------------------------------------------------------*/
/* l i b . h */
/* */
/* Update log: */
/* */
/* 13 May 89 Added PCMAILVER ahd */
/* Summer 89 Added equali, equalni, compiled, */
/* compilet ahd */
/* 22 Sep 89 Add boolean typedef ahd */
/* 01 Oct 89 Make logecho boolean ahd */
/* 19 Mar 90 Move FOPEN prototype to here ahd */
/* 02 May 1990 Allow set of booleans options via options= */
/* 8 May 90 Add 'pager' option */
/* 10 May 90 Add 'purge' option */
/*--------------------------------------------------------------------*/
#ifndef __LIB
#define __LIB
/*--------------------------------------------------------------------*/
/* Environment variables set by UUXQT before invoking modules */
/*--------------------------------------------------------------------*/
#define UU_USER "UU_USER"
#define UU_MACHINE "UU_MACHINE"
#define LOGNAME "LOGNAME"
/*--------------------------------------------------------------------*/
/* Macro for recording when UUPC dies */
/*--------------------------------------------------------------------*/
#define panic() bugout( __LINE__, cfnptr)
/*--------------------------------------------------------------------*/
/* Macro for generic error messages from DOS */
/*--------------------------------------------------------------------*/
#define printerr( x ) prterror( __LINE__, cfnptr, x)
/*--------------------------------------------------------------------*/
/* Configuration file defines */
/*--------------------------------------------------------------------*/
#define B_REQUIRED 0x00000001 /* Line must appear in configuration */
#define B_FOUND 0x00000002 /* We found the token */
#define B_GLOBAL 0x00000004 /* Must not appear in PERSONAL.RC */
#define B_LOCAL 0x00000008 /* The opposite of B_GLOBAL, sort of */
#define B_MUA 0x00000010 /* Used by Mail User Agent (MAIL) */
#define B_UUIO 0x00000020 /* Used by transport program (UUIO) */
#define B_MTA 0x00000040 /* Used by Mail Delivery (RMAIL) */
#define B_UUCP 0x00000080 /* Used by UUCP command */
#define B_NEWS 0x00000100 /* Used by NEWS software */
#define B_MUSH 0x00000200 /* Used by MUSH - Not used by UUPC */
#define B_MAIL (B_MUA | B_MTA | B_MUSH)
#define B_ALL (B_MUA | B_MTA | B_MUSH | B_UUIO | B_NEWS | B_UUCP)
#define B_SPOOL (B_MTA | B_UUIO| B_UUCP)
#define B_INTEGER 0x00000400 /* Pointer is to short int, not string */
#define B_TOKEN 0x00000800 /* Pointer is one word, ignore blanks */
#define B_BOOLEAN 0x00001000 /* Pointer is to boolean keywords */
#define B_LIST 0x00002000 /* Pointer to array of char pointers */
#define B_CLIST 0x00004000 /* Pointet to array of char pointers,
input is separated by colons, not
spaces */
#define B_STRING 0x00008000 /* String value (same as original UUPC)*/
/*--------------------------------------------------------------------*/
/* General defines and macros */
/*--------------------------------------------------------------------*/
#define MESSAGESEP "\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\n"
#define DCSTATUS "hostatus"
#define LOGFILE "uucico.log"
#define XQTLOG "uuxqt.log"
#define PASSWD "passwd"
#define PATHS "hostpath"
#define PERMISSIONS "permissn"
#define RMAILLOG "rmail.log"
#define SYSLOG "syslog"
#define SYSTEMS "systems"
#define WHITESPACE " \t\n\r"
/*--------------------------------------------------------------------*/
/* Equality macros */
/*--------------------------------------------------------------------*/
#define equal(a,b) (!strcmp(a,b))
#define equali(a,b) (!stricmp(a,b)) /*ahd */
#define equalni(a,b,n) (!strnicmp(a,b,n)) /*ahd */
#define equaln(a,b,n) (!strncmp(a,b,n))
#define currentfile() static char *cfnptr = __FILE__
#define checkref(a) (checkptr(a, cfnptr ,__LINE__)); /*ahd */
#define nil(type) ((type *)NULL)
/*--------------------------------------------------------------------*/
/* Enumerated list used by the options= configuration line */
/*--------------------------------------------------------------------*/
typedef enum {
/* Per user options */
F_ASKCC, /* TRUE = ask for Carbon copies */
F_DOSKEY, /* TRUE = Use DOSKEY under DOS 5 if available*/
F_BACKUP, /* TRUE = Backup mailbox before rewriting */
F_DOT, /* TRUE = period ends a message */
F_AUTOPRINT, /* TRUE = print next message automatically */
F_AUTOEDIT, /* TRUE = no line prompt, always edit */
F_AUTOINCLUDE, /* TRUE = Perform automatic INCLUDE command */
F_AUTOSIGN, /* TRUE = append the signature file */
F_EXPERT, /* TRUE = Let user shoot self in foot w/o
a message. */
F_FROMSEP, /* TRUE = Allow From to split messages */
F_PAGER, /* TRUE = Invert meaning of P/p T/t commands */
F_PURGE, /* TRUE = Delete mailbox, if empty */
F_SAVE, /* TRUE = Save read messages in =mbox when
reading new mail. */
F_DIRECT, /* TRUE = Deliver to subdirectories, not
files */
F_SAVERESENT, /* TRUE = Save forwarded mail a second time */
F_VERBOSE, /* TRUE = Verbose RMAIL output */
/* Per system (GLOBAL) options */
F_BANG, /* TRUE = re-write addresses in bang (!) form*/
F_HISTORY, /* TRUE = Maintain history of of articles
read and posted */
F_KANJI, /* TRUE = enable Kanji (Japanese) support */
F_MULTI, /* TRUE = Deliver to multiple addresses on
remote host at once */
F_ONECASE, /* TRUE = Remote host is case insensitive */
F_SYSLOG, /* TRUE = Write syslog with name and time of
each file transferred */
F_LAST } /* Dummy - Must be last - defines array size */
B_FLAG; /* Boolean flag array - ahd */
/*--------------------------------------------------------------------*/
/* Your basic Boolean logic values */
/*--------------------------------------------------------------------*/
#undef FALSE
#undef TRUE
typedef enum { FALSE = 0, TRUE = 1 } boolean;
/*--------------------------------------------------------------------*/
/* Configuration mode flags */
/*--------------------------------------------------------------------*/
typedef enum {
USER_CONFIG,
SYSTEM_CONFIG,
MODEM_CONFIG
} SYSMODE;
/*--------------------------------------------------------------------*/
/* enumerated type for configuration bits */
/*--------------------------------------------------------------------*/
typedef unsigned long CONFIGBITS;
typedef unsigned short INTEGER; /* Integers in the config file */
typedef unsigned int BPS;
/*--------------------------------------------------------------------*/
/* Configuration table layout */
/*--------------------------------------------------------------------*/
typedef struct ConfigTable {
char *sym;
char **loc;
CONFIGBITS bits;
} CONFIGTABLE;
/*--------------------------------------------------------------------*/
/* Boolean options table layout */
/*--------------------------------------------------------------------*/
typedef struct FlagTable {
char *sym;
int position;
CONFIGBITS bits;
} FLAGTABLE;
/*--------------------------------------------------------------------*/
/* linked list */
/*--------------------------------------------------------------------*/
struct file_queue {
char name[FILENAME_MAX];
struct file_queue *next_link;
} ;
/*--------------------------------------------------------------------*/
/* Global variables */
/*--------------------------------------------------------------------*/
extern int debuglevel;
extern boolean logecho;
extern FILE *logfile;
extern boolean bflag[F_LAST];
/*--------------------------------------------------------------------*/
/* Configuration file strings */
/*--------------------------------------------------------------------*/
extern char *name, *mailbox, *homedir;
extern char *archivedir, *newsserv; /* news */
extern char *mailbox, *homedir;
extern char *maildir, *newsdir, *spooldir, *confdir, *pubdir, *tempdir;
extern char *nodename, *domain, *mailserv;
extern char *fdomain; /* Domain used in From: lines */
extern char *E_inmodem;
extern char *E_editor, *E_pager;
extern char *E_mailext, *E_backup;
extern char *E_filesent, *E_signature;
extern char *E_altsignature; /* pdm */
extern char *aliases; /* ahd */
extern char *organization, *replyto; /* ahd */
extern char *localdomain; /* ahd */
extern char *postmaster; /* ahd */
extern char *E_rmail;
extern char *E_rnews;
extern char *E_uuxqtpath;
extern char *E_charset;
extern char *anonymous;
extern INTEGER maxhops;
extern INTEGER PacketTimeout;
extern INTEGER PortTimeout;
extern INTEGER MaxErr;
extern INTEGER xfer_bufsize;
extern FLAGTABLE configFlags[];
/*--------------------------------------------------------------------*/
/* Function prototypes */
/*--------------------------------------------------------------------*/
void prterror(const size_t lineno, const char *fname, const char *prefix);
extern void checkptr(const void *block, const char *file, const int line);
extern int MKDIR(const char *path);
/* Make a directory ahd */
extern int CHDIR(const char *path);
/* Change to a directory ahd */
extern int CREAT(const char *name,
const int mode,
const char ftype); /* ahd */
int RENAME(const char *oldname, const char *newname );
extern FILE *FOPEN(const char *name,
const char *mode,
const char ftype); /* ahd */
extern void options(char *s,
SYSMODE sysmode ,
FLAGTABLE *flags,
boolean *xflag);
int getargs(char *line,
char **flds); /* ahd */
void printmsg(int level, char *fmt, ...);
boolean configure( CONFIGBITS program );
boolean getconfig(FILE *fp,
SYSMODE sysmode,
CONFIGBITS program,
CONFIGTABLE *table,
FLAGTABLE *btable);
boolean processconfig(char *buff,
SYSMODE sysmode,
CONFIGBITS program,
CONFIGTABLE *table,
FLAGTABLE *btable);
void bugout( const size_t lineno, const char *fname);
/*--------------------------------------------------------------------*/
/* Compiler specific information */
/*--------------------------------------------------------------------*/
#if defined(__CORE__)
extern char *copyright;
extern char *copywrong;
extern long *lowcore;
#endif /* defined(__CORE__) */
#endif /* ifndef __LIB */